import { _decorator, Component, Canvas, AssetManager, assetManager} from 'cc';
const { ccclass, property } = _decorator;

@ccclass('Boost')
export class Boost extends Component {

    // @property(Prefab)
    // private match3Prefab: Prefab = null;

    @property(Canvas)
    private canvas2d: Canvas = null;

    private loadBundle(bundleName: string): Promise<AssetManager.Bundle> {
        return new Promise<AssetManager.Bundle>((resolve, reject) => {
            assetManager.loadBundle(bundleName, (e, bundle) => {
                if (e) {
                    console.error("Boost loadBundle error: ", e);
                    resolve(null);
                    return;
                }
                resolve(bundle);
            })
        })
    }

    public async start() {
        await this.loadBundle("GScriptBN");
        const gCtr: any = this.node.addComponent("GCtr");
        await gCtr.init(this.canvas2d);
    }
}


